class AddCommentableIdAndTypeToComment < ActiveRecord::Migration
  def self.up
    execute 'ALTER TABLE comments ADD COLUMN commentable_id int(11)'
    execute 'ALTER TABLE comments ADD COLUMN commentable_type varchar(32)'
    Comment.find_all.each do |c|
      c.update_attribute(:commentable_id,c.ecase_id)
      c.update_attribute(:commentable_type,'Ecase')
    end
    execute 'ALTER TABLE comments DROP COLUMN ecase_id'
  end

  def self.down
  end
end
